using System;
using System.Collections.Generic;
using System.Text;
//http://www.sqldbatips.com/showarticle.asp?ID=34

namespace SQLCodeCreator.DBInfo.SqlServer.Databases
{
    public class SqlServer
    {
        string _ServerName;
        string _Machine;
        string _IP;

        public string IP
        {
            get { return _IP; }
        }

        public string ServerName
        {
            get { return _ServerName; }
        }
        public string Machine
        {
            get { return _Machine; }
        }

        public SqlServer()
        {
        }
        public SqlServer(SqlServer server)
        {
            _ServerName = server._ServerName;
            _Machine = server._Machine;
            _IP = server._IP;
        }
       

        public static List<SqlServer> SqlServerRegisteredServerSearch()
        {
		    Util.SqlServerInfo[] srvs = Util.SqlServerInfo.Seek();

            List<SqlServer> servers = new List<SqlServer>();
            SqlServer server;
            foreach (Util.SqlServerInfo svr in srvs)
            {
                server = new SqlServer();
                server._ServerName = svr.ServerName;
                server._Machine = svr.InstanceName;
                server._IP = svr.Address.ToString();
                servers.Add(server);
            }

            return servers;
        }
    }
   
}
